package bankofficegrepper

/**
 * Created by IntelliJ IDEA.
 * User: janexie
 * Date: 2010-11-27
 * Time: 15:57:52
 * To change this template use File | Settings | File Templates.
 */
class ICBCBankInfoResolver extends BankInfoResolver {
  def resolveData(def source) {
    def records = new XmlSlurper().parseText(source)
    List list = []
    def bankInfoRows = records.body.form.div.table.tbody.tr.td.table.tbody.tr[1].td.table.tbody.tr
    bankInfoRows = bankInfoRows[1..bankInfoRows.size() - 1]
    bankInfoRows.each {
      def bankInfoRow = it.td
      BankInfo info = new BankInfo();
      info.province = bankInfoRow[0]
      info.city = bankInfoRow[1]
      info.type = bankInfoRow[2]
      info.name = bankInfoRow[3]
      info.address = bankInfoRow[4]
      info.telephoneNo = bankInfoRow[5]
      info.bankName = 'ICBC'
      list += info
    }
    return list
  }
}
